<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#375EAB">
<title>Gosl &ndash; package chk</title>
<link type="text/css" rel="stylesheet" href="static/style.css">
<script type="text/javascript" src="static/godocs.js"></script>
<style type="text/css"></style>
</head>
<body>
<div id="page" class=\wide">
<div class="container">
<h1>Gosl &ndash; <b>chk</b> &ndash; Check code and unit test tools</h1>
use 'godoc cmd/github.com/cpmech/gosl/chk' for documentation on the github.com/cpmech/gosl/chk command 

<!--
	Copyright 2009 The Go Authors. All rights reserved.
	Use of this source code is governed by a BSD-style
	license that can be found in the LICENSE file.
-->
<!--
	Note: Static (i.e., not template-generated) href and id
	attributes start with "pkg-" to make it impossible for
	them to conflict with generated attributes (some of which
	correspond to Go identifiers).
-->

	<script type='text/javascript'>
	document.ANALYSIS_DATA = ;
	document.CALLGRAPH = ;
	</script>

	
		
		<div id="short-nav">
			<dl>
			<dd><code>import "github.com/cpmech/gosl/chk"</code></dd>
			</dl>
			<dl>
			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
			<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
			
			
			</dl>
		</div>
		<!-- The package's Name is printed as title by the top-level template -->
		<div id="pkg-overview" class="toggleVisible">
			<div class="collapsed">
				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
			</div>
			<div class="expanded">
				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
				<p>
package chk contains functions for checking and testing computations
</p>

			</div>
		</div>
		

		<div id="pkg-index" class="toggleVisible">
		<div class="collapsed">
			<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
		</div>
		<div class="expanded">
			<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>

		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
			<div id="manual-nav">
			<dl>
			
			
				<dd><a href="#pkg-variables">Variables</a></dd>
			
			
				
				<dd><a href="#AnaNum">func AnaNum(tst *testing.T, msg string, tol, ana, num float64, verbose bool)</a></dd>
			
				
				<dd><a href="#Bools">func Bools(tst *testing.T, msg string, a, b []bool)</a></dd>
			
				
				<dd><a href="#CallerInfo">func CallerInfo(idx int)</a></dd>
			
				
				<dd><a href="#CheckAndPrint">func CheckAndPrint(tst *testing.T, msg string, tol, diff float64)</a></dd>
			
				
				<dd><a href="#DblAssert">func DblAssert(a, b float64)</a></dd>
			
				
				<dd><a href="#Deep3">func Deep3(tst *testing.T, msg string, tol float64, a, b [][][]float64)</a></dd>
			
				
				<dd><a href="#Deep4">func Deep4(tst *testing.T, msg string, tol float64, a, b [][][][]float64)</a></dd>
			
				
				<dd><a href="#Err">func Err(msg string, prm ...interface{}) error</a></dd>
			
				
				<dd><a href="#GetFunctionName">func GetFunctionName(i interface{}) string</a></dd>
			
				
				<dd><a href="#Int">func Int(tst *testing.T, msg string, val, correct int)</a></dd>
			
				
				<dd><a href="#IntAssert">func IntAssert(a, b int)</a></dd>
			
				
				<dd><a href="#IntAssertLessThan">func IntAssertLessThan(a, b int)</a></dd>
			
				
				<dd><a href="#IntAssertLessThanOrEqualTo">func IntAssertLessThanOrEqualTo(a, b int)</a></dd>
			
				
				<dd><a href="#IntMat">func IntMat(tst *testing.T, msg string, res, correct [][]int)</a></dd>
			
				
				<dd><a href="#Ints">func Ints(tst *testing.T, msg string, a, b []int)</a></dd>
			
				
				<dd><a href="#Matrix">func Matrix(tst *testing.T, msg string, tol float64, res, correct [][]float64)</a></dd>
			
				
				<dd><a href="#MatrixC">func MatrixC(tst *testing.T, msg string, tol float64, res, correct [][]complex128)</a></dd>
			
				
				<dd><a href="#Panic">func Panic(msg string, prm ...interface{})</a></dd>
			
				
				<dd><a href="#PanicSimple">func PanicSimple(msg string, prm ...interface{})</a></dd>
			
				
				<dd><a href="#PrintAnaNum">func PrintAnaNum(msg string, tol, ana, num float64, verbose bool) (e error)</a></dd>
			
				
				<dd><a href="#PrintFail">func PrintFail(msg string, prm ...interface{})</a></dd>
			
				
				<dd><a href="#PrintOk">func PrintOk(msg string, prm ...interface{})</a></dd>
			
				
				<dd><a href="#PrintTitle">func PrintTitle(title string)</a></dd>
			
				
				<dd><a href="#Scalar">func Scalar(tst *testing.T, msg string, tol, res, correct float64)</a></dd>
			
				
				<dd><a href="#StrAssert">func StrAssert(a, b string)</a></dd>
			
				
				<dd><a href="#StrMat">func StrMat(tst *testing.T, msg string, res, correct [][]string)</a></dd>
			
				
				<dd><a href="#String">func String(tst *testing.T, str, correct string)</a></dd>
			
				
				<dd><a href="#Strings">func Strings(tst *testing.T, msg string, a, b []string)</a></dd>
			
				
				<dd><a href="#Vector">func Vector(tst *testing.T, msg string, tol float64, res, correct []float64)</a></dd>
			
				
				<dd><a href="#VectorC">func VectorC(tst *testing.T, msg string, tol float64, res, correct []complex128)</a></dd>
			
			
			
			</dl>
			</div><!-- #manual-nav -->

		

		
			<h4>Package files</h4>
			<p>
			<span style="font-size:90%">
			
				<a href="/src/github.com/cpmech/gosl/chk/asssert.go">asssert.go</a>
			
				<a href="/src/github.com/cpmech/gosl/chk/auxiliary.go">auxiliary.go</a>
			
				<a href="/src/github.com/cpmech/gosl/chk/chk.go">chk.go</a>
			
				<a href="/src/github.com/cpmech/gosl/chk/testing.go">testing.go</a>
			
			</span>
			</p>
		
		</div><!-- .expanded -->
		</div><!-- #pkg-index -->

		<div id="pkg-callgraph" class="toggle" style="display: none">
		<div class="collapsed">
			<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
		</div> <!-- .expanded -->
		<div class="expanded">
			<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
			<p>
			  In the call graph viewer below, each node
			  is a function belonging to this package
			  and its children are the functions it
			  calls&mdash;perhaps dynamically.
			</p>
			<p>
			  The root nodes are the entry points of the
			  package: functions that may be called from
			  outside the package.
			  There may be non-exported or anonymous
			  functions among them if they are called
			  dynamically from another package.
			</p>
			<p>
			  Click a node to visit that function's source code.
			  From there you can visit its callers by
			  clicking its declaring <code>func</code>
			  token.
			</p>
			<p>
			  Functions may be omitted if they were
			  determined to be unreachable in the
			  particular programs or tests that were
			  analyzed.
			</p>
			<!-- Zero means show all package entry points. -->
			<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
		</div>
		</div> <!-- #pkg-callgraph -->

		
		
			<h2 id="pkg-variables">Variables</h2>
			
				<pre>var (
    <span id="AssertOn">AssertOn</span> = <a href="/pkg/builtin/#true">true</a> <span class="comment">// activates/deactivates asserts</span>
    <span id="Verbose">Verbose</span>  = <a href="/pkg/builtin/#false">false</a>
    <span id="ColorsOn">ColorsOn</span> = <a href="/pkg/builtin/#true">true</a>
)</pre>
				
			
		
		
			
			
			<h2 id="AnaNum">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=423:499#L9">AnaNum</a></h2>
			<pre>func AnaNum(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol, ana, num <a href="/pkg/builtin/#float64">float64</a>, verbose <a href="/pkg/builtin/#bool">bool</a>)</pre>
			<p>
AnaNum compares analytical versus numerical values
</p>

			
			

		
			
			
			<h2 id="Bools">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=1810:1861#L54">Bools</a></h2>
			<pre>func Bools(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, a, b []<a href="/pkg/builtin/#bool">bool</a>)</pre>
			<p>
Bools compare two slices of bools
</p>

			
			

		
			
			
			<h2 id="CallerInfo">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=522:546#L14">CallerInfo</a></h2>
			<pre>func CallerInfo(idx <a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
CallerInfo returns the file and line positions where an error occurred
</p>
<pre>idx -- use idx=2 to get the caller of Panic
</pre>

			
			

		
			
			
			<h2 id="CheckAndPrint">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=1834:1899#L80">CheckAndPrint</a></h2>
			<pre>func CheckAndPrint(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol, diff <a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
PrintMsg returns a formatted error message
</p>

			
			

		
			
			
			<h2 id="DblAssert">func <a href="https://github.com/cpmech/gosl/blob/master/chk/asssert.go?s=908:936#L33">DblAssert</a></h2>
			<pre>func DblAssert(a, b <a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
DblAssert asserts that a is equal to b (floats)
</p>

			
			

		
			
			
			<h2 id="Deep3">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=9324:9395#L306">Deep3</a></h2>
			<pre>func Deep3(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, a, b [][][]<a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
Deep3 compares two deep3 slices
</p>

			
			

		
			
			
			<h2 id="Deep4">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=10546:10619#L337">Deep4</a></h2>
			<pre>func Deep4(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, a, b [][][][]<a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
Deep4 compares two deep4 slices
</p>

			
			

		
			
			
			<h2 id="Err">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=1115:1161#L44">Err</a></h2>
			<pre>func Err(msg <a href="/pkg/builtin/#string">string</a>, prm ...interface{}) <a href="/pkg/builtin/#error">error</a></pre>
			<p>
Err returns a new error
</p>

			
			

		
			
			
			<h2 id="GetFunctionName">func <a href="https://github.com/cpmech/gosl/blob/master/chk/auxiliary.go?s=487:529#L19">GetFunctionName</a></h2>
			<pre>func GetFunctionName(i interface{}) <a href="/pkg/builtin/#string">string</a></pre>
			<p>
GetFunctionName returns the name of a function
</p>

			
			

		
			
			
			<h2 id="Int">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=919:973#L27">Int</a></h2>
			<pre>func Int(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, val, correct <a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
Int compares two ints
</p>

			
			

		
			
			
			<h2 id="IntAssert">func <a href="https://github.com/cpmech/gosl/blob/master/chk/asssert.go?s=224:248#L1">IntAssert</a></h2>
			<pre>func IntAssert(a, b <a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
IntAssert asserts that a is equal to b (ints)
</p>

			
			

		
			
			
			<h2 id="IntAssertLessThan">func <a href="https://github.com/cpmech/gosl/blob/master/chk/asssert.go?s=439:471#L9">IntAssertLessThan</a></h2>
			<pre>func IntAssertLessThan(a, b <a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
IntAssertLessThan asserts that a &lt; b (ints)
</p>

			
			

		
			
			
			<h2 id="IntAssertLessThanOrEqualTo">func <a href="https://github.com/cpmech/gosl/blob/master/chk/asssert.go?s=671:712#L21">IntAssertLessThanOrEqualTo</a></h2>
			<pre>func IntAssertLessThanOrEqualTo(a, b <a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
IntAssertLessThanOrEqualTo asserts that a ≤ b (ints)
</p>

			
			

		
			
			
			<h2 id="IntMat">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=8217:8278#L271">IntMat</a></h2>
			<pre>func IntMat(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, res, correct [][]<a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
IntMat compares matrices of ints
</p>

			
			

		
			
			
			<h2 id="Ints">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=1247:1296#L37">Ints</a></h2>
			<pre>func Ints(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, a, b []<a href="/pkg/builtin/#int">int</a>)</pre>
			<p>
Ints compares two slices of integers
</p>

			
			

		
			
			
			<h2 id="Matrix">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=2959:3037#L88">Matrix</a></h2>
			<pre>func Matrix(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, res, correct [][]<a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
Matrix compares two matrices
</p>

			
			

		
			
			
			<h2 id="MatrixC">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=4715:4797#L154">MatrixC</a></h2>
			<pre>func MatrixC(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, res, correct [][]<a href="/pkg/builtin/#complex128">complex128</a>)</pre>
			<p>
MatrixC compares two matrices of complex nummbers
</p>

			
			

		
			
			
			<h2 id="Panic">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=962:1004#L36">Panic</a></h2>
			<pre>func Panic(msg <a href="/pkg/builtin/#string">string</a>, prm ...interface{})</pre>
			<p>
Panic panicks
</p>

			
			

		
			
			
			<h2 id="PanicSimple">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=858:906#L31">PanicSimple</a></h2>
			<pre>func PanicSimple(msg <a href="/pkg/builtin/#string">string</a>, prm ...interface{})</pre>
			<p>
PanicSimple panicks without calling CallerInfo
</p>

			
			

		
			
			
			<h2 id="PrintAnaNum">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=2297:2372#L96">PrintAnaNum</a></h2>
			<pre>func PrintAnaNum(msg <a href="/pkg/builtin/#string">string</a>, tol, ana, num <a href="/pkg/builtin/#float64">float64</a>, verbose <a href="/pkg/builtin/#bool">bool</a>) (e <a href="/pkg/builtin/#error">error</a>)</pre>
			<p>
PrintAnaNum formats the output of analytical versus numerical comparisons
</p>

			
			

		
			
			
			<h2 id="PrintFail">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=1389:1435#L59">PrintFail</a></h2>
			<pre>func PrintFail(msg <a href="/pkg/builtin/#string">string</a>, prm ...interface{})</pre>
			
			
			

		
			
			
			<h2 id="PrintOk">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=1212:1256#L48">PrintOk</a></h2>
			<pre>func PrintOk(msg <a href="/pkg/builtin/#string">string</a>, prm ...interface{})</pre>
			
			
			

		
			
			
			<h2 id="PrintTitle">func <a href="https://github.com/cpmech/gosl/blob/master/chk/chk.go?s=1609:1638#L71">PrintTitle</a></h2>
			<pre>func PrintTitle(title <a href="/pkg/builtin/#string">string</a>)</pre>
			<p>
PrintTitle returns the Test Title
</p>

			
			

		
			
			
			<h2 id="Scalar">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=244:310#L4">Scalar</a></h2>
			<pre>func Scalar(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol, res, correct <a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
Scalar compares two scalars
</p>

			
			

		
			
			
			<h2 id="StrAssert">func <a href="https://github.com/cpmech/gosl/blob/master/chk/asssert.go?s=1135:1162#L44">StrAssert</a></h2>
			<pre>func StrAssert(a, b <a href="/pkg/builtin/#string">string</a>)</pre>
			<p>
StrAssert asserts that a is equal to b (strings)
</p>

			
			

		
			
			
			<h2 id="StrMat">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=7092:7156#L236">StrMat</a></h2>
			<pre>func StrMat(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, res, correct [][]<a href="/pkg/builtin/#string">string</a>)</pre>
			<p>
StrMat compares matrices of strings
</p>

			
			

		
			
			
			<h2 id="String">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=631:679#L17">String</a></h2>
			<pre>func String(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, str, correct <a href="/pkg/builtin/#string">string</a>)</pre>
			<p>
String compares two strings
</p>

			
			

		
			
			
			<h2 id="Strings">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=2387:2442#L71">Strings</a></h2>
			<pre>func Strings(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, a, b []<a href="/pkg/builtin/#string">string</a>)</pre>
			<p>
Strings compare two slices of strings
</p>

			
			

		
			
			
			<h2 id="Vector">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=3958:4034#L125">Vector</a></h2>
			<pre>func Vector(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, res, correct []<a href="/pkg/builtin/#float64">float64</a>)</pre>
			<p>
Vector compares two vectors
</p>

			
			

		
			
			
			<h2 id="VectorC">func <a href="https://github.com/cpmech/gosl/blob/master/chk/testing.go?s=6044:6124#L199">VectorC</a></h2>
			<pre>func VectorC(tst *<a href="/pkg/testing/">testing</a>.<a href="/pkg/testing/#T">T</a>, msg <a href="/pkg/builtin/#string">string</a>, tol <a href="/pkg/builtin/#float64">float64</a>, res, correct []<a href="/pkg/builtin/#complex128">complex128</a>)</pre>
			<p>
VectorC compares two vectors of complex nummbers
</p>

			
			

		
		
	

	






<div id="footer">
<br /><br />
<hr>
<pre class="copyright">
Copyright (c) 2016, The Gosl Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of Gosl nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

</pre><!-- copyright -->
</div><!-- footer -->

</div><!-- container -->
</div><!-- page -->
</body>
</html>
